home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Hardware / Mac OS USB DDK / Mac OS USB DDK 1.4.1 / Examples / USBModem / ModemDriver.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-25  |  3.0 KB  |  112 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        ModemDriver.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1999 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     File Ownership:
  11.  
  12.         DRI:                xxx put dri here xxx
  13.  
  14.         Other Contact:        xxx put other contact here xxx
  15.  
  16.         Technology:            xxx put technology here xxx
  17.  
  18. */
  19.  
  20. #ifndef    _MODEMDRIVER_
  21. #define    _MODEMDRIVER_
  22.  
  23. typedef struct{
  24.     USBPB                         pb;
  25.     UInt8                         *errorString;
  26.     UInt16                         interfacenum;
  27.     USBDeviceRef                 deviceRef;
  28.     USBPipeRef                     interrupt;
  29.     USBPipeRef                     bulkIn;
  30.     USBPipeRef                     bulkOut;
  31.     USBDeviceDescriptorPtr        deviceDescriptor;
  32.     UInt8                        modemStatus;
  33.     UInt8                        lineStatus;
  34.     UInt8                         onError;
  35.     UInt8                         retries;
  36.     Boolean                        DTRClose;            // true means don't negate DTR
  37.     UInt16                        modemUSBStatus;        // Modem and line status USB
  38.     UInt16                        lineState;            // Current USB line state
  39.     LineParms                    Line_Settings;        // USB current line settings    
  40.     } serPB;
  41.  
  42. enum{
  43.     kReset                     = 0,
  44.     kCommConfig             = 1,
  45.     kSetConfig                 = 2,
  46.     kGetCommInterface         = 3,
  47.     kSetCommInterface        = 4,
  48.     kConfigureCommInterface = 5,
  49.     kGetInterruptEndpoint     = 6,
  50.     kDataConfig             = 7,
  51.     kGetDataInterface         = 8,
  52.     kConfigureDataInterface = 9,
  53.     kGetBulkOutEndpoint     = 10,
  54.     kGetBulkInEndpoint         = 11,
  55.     kConfigDone             = 12,
  56.     
  57.     kEndpointStall             = 1,
  58.     kStallDone                 = 2,
  59.     
  60.     kResetDevice             = 1,
  61.     kResetDone                = 2,
  62.     
  63.     kAvailableStatus         = 'okok'
  64.     };
  65.  
  66. /********************************************************************************************/
  67. //
  68. //    Prototypes
  69. //
  70. /********************************************************************************************/
  71.  
  72. void         USBStatus(UInt32 level, USBDeviceRef ref, void *pointer, UInt32 value);
  73. static         Boolean immediateError(OSStatus err);
  74. static void ConfigurationHandler(USBPB *pb);
  75. static void ResetInterruptPB(USBPB *pb);
  76. static void interruptCompletion(USBPB *pb);
  77. static void StartStatusMonitor(USBPipeRef interruptPipe);
  78. static void syncCompletion(USBPB *pb);
  79. Boolean     TimeoutPrevRequest(void);
  80. Boolean     TimeoutStallRequest(void);
  81. Boolean     TimeoutDelayRequest(void);
  82. void         USBSetBaudRate(UInt32 baudRate);
  83. void         USBSetLineCoding(LineParms Line_Coding);
  84. void         USBSetControlLineState(void);
  85. void         USBSetDTRState(Boolean state);
  86. void         USBSetRTSState(Boolean state);
  87. void         USBSendBreak(Boolean state);
  88. void         USBSetCloseDTR(void);
  89. UInt8         USBGetDCDValue(void);
  90. OSStatus     modemDriverEntry(USBDeviceRef device, USBDeviceDescriptor *desc);
  91. static void InitializePB(USBPB *pb, USBDeviceRef ref, USBCompletion handler);
  92. void         readCompletion(USBPB *pb);
  93. void         USBStartReadPolling();
  94. void         USBStopReadPolling(void);
  95. void         writeCompletion(USBPB *pb);
  96. OSStatus     USBSerialWrite(IOParam *pb);
  97. void         KillUSBIO(void);
  98. void         InitLineCoding(LineParms Line_Coding);
  99. void         DoDelay(void);
  100. static void delayHandler(USBPB *pb);
  101. void         ClearDevice(void);
  102. static void stallHandler(USBPB *pb);
  103. void         ResetDevice(void);
  104. static void ResetHandler(USBPB *pb);
  105. UInt8         Asciify(UInt8 i);
  106.  
  107. #if ((DebugOn > 0) && (LogOn > 0))
  108. void         USBLogData(UInt8 Dir, UInt32 Count, UInt8 *buf);
  109. #endif
  110.  
  111. #endif
  112.